<include file="Index:header"/>
<include file="Index:menu"/>
<link href="__PUBLIC__/color/jquery-ui.css" rel="stylesheet" type="text/css" media="all">
<link href="__PUBLIC__/color/evol.colorpicker.min.css" rel="stylesheet" type="text/css" media="all">
<script src="__PUBLIC__/color/jquery-ui.min.js"></script>
<script src="__PUBLIC__/color/evol.colorpicker.min.js"></script>

	<div class="row">
	  <div class="col-md-10">
      <form class="form-horizontal" role="form" action="{:U('Index/post_add_info',array('bid'=>$ids['bid']))}" method="post">
        <legend>发布新内容</legend>
        <div class="form-group">
          <label class="col-md-2 control-label">提案名称{:bitian()}</label>
          <div class="col-md-10">
			<input type="text"  class="form-control"  placeholder="提案名称" id="title" name="title"  value="{$rs['title']}" >
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label">标签</label>
          
		  <php>$list_rs=M('lz_tags')->select();</php>
		  <div class="col-md-4">
             <select  class="form-control" id="tag_list" name="tag_list" <php>if($ids['bid']){ echo "readonly";}</php> >
				<option value="">...</option>
				<php>foreach($list_rs as $k=>$v){</php>
				<option value="{$v.tid}@@{$v.tag_name}@@{$v.tag_color}" {:is_selected($v['tid']."@@".$v['tag_name']."@@".$v['tag_color'],$rs['tid']."@@".$rs['tag']."@@".$rs['tag_color'])} > <php>echo $v['tag_name'];</php></option>
				<php>}</php>
			 </select>
          </div>
          <label class="col-md-2 control-label">来源网站</label>
          <div class="col-md-4">
             <input type="text"  class="form-control" placeholder="来源网站" id="site" name="site" value="{$rs['site']}">
          </div>
        </div>
		<input id="tid" name="tid" type="hidden">
		<input id="tag" name="tag" type="hidden">
		<input id="tag_color" name="tag_color" type="hidden">
        <div class="form-group">
          <label class="col-md-2 control-label">来源网址</label>
          <div class="col-md-10">
			<input type="text"  class="form-control"  placeholder="http://xxxx.xxx.xxx" id="url" name="url"  value="{$rs['url']}" >
          </div>
        </div>
		
        <div class="form-group">
          <label class="col-md-2 control-label">内容{:bitian()}:</label>
          <div class="col-md-10">
		  <textarea  id="body" name="body" class="form-control kindeditorSimple" style="height:500px;">{:htmlspecialchars_decode($rs['body'])}</textarea>
          </div>
        </div>
		<div class="form-group">
          <div class="col-md-offset-2 col-md-10">
             <button id='add_new' class='btn btn-primary'/>发布</button> 
          </div>
        </div>
		
      </form>
	  </div>
	</div>
<script>
	load_kindeditor();
	function load_kindeditor() {
		var initKindeditor = function(){
			var K = window.KindEditor;
			if(K)
			{
				K.create('textarea.kindeditorSimple',
				{
					basePath: '__PUBLIC__/lib/kindeditor/',
					bodyClass : 'article-content',
					resizeType : 1,
					allowPreviewEmoticons : true,
					allowImageUpload : true,
					allowImageRemote : false,
					items : [
					'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
					'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
					'insertunorderedlist', '|', 'emoticons', 'image', 'link'],
					afterBlur: function(){$('#contentSimple').prev('.ke-container').removeClass('focus');},
					afterFocus: function(){$('#contentSimple').prev('.ke-container').addClass('focus');}
				});
			}
		};

		$.getScript('__PUBLIC__/lib/kindeditor/kindeditor.min.js', initKindeditor);

	}
	

	$('#tag_color').colorpicker({
		hideButton: true
	}).on('change.color', function(evt, color){
		$('#tag_color_dot').css('background-color',color);
	})
	.on('mouseover.color', function(evt, color){
		if(color){
			$('#tag_color_dot').css('background-color',color);
		}
	});
	
	$("#tag_list").change(function(){
		var tag_list=$(this).val();
		var tmp_tags=tag_list.split("@@");
		$("#tid").val(tmp_tags[0]);
		$("#tag").val(tmp_tags[1]);
		$("#tag_color").val(tmp_tags[2]);
	});
</script>
<include file="Index:footer"/>